//package org.qiyu.live.gateway.XssFilter;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
//import org.springframework.core.Ordered;
//import org.springframework.stereotype.Component;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono;
//
///**
// * @Description: //todo
// * @Author: 张广焱
// * @Date: 2024-04-23 下午8:38
// */
//@Component
//public class GlobalCacheRequestFilter implements GlobalFilter, Ordered {
//private static final Logger logger = LoggerFactory.getLogger(GlobalCacheRequestFilter.class);
//
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        logger.info("exchange is {},chain is{}",exchange,chain);
//        // 只缓存json类型请求
//        if (!JsonUtils.isJsonRequest(exchange)) {
//            return chain.filter(exchange);
//        }
////        if (!JsonUtilsAll.isJsonRequest(exchange)) {
////            return chain.filter(exchange);
////        }
//        return ServerWebExchangeUtils.cacheRequestBody(exchange, (serverHttpRequest) -> {
//            if (serverHttpRequest == exchange.getRequest()) {
//                return chain.filter(exchange);
//            }
//            return chain.filter(exchange.mutate().request(serverHttpRequest).build());
//        });
//    }
//
//    @Override
//    public int getOrder() {
//        return Ordered.HIGHEST_PRECEDENCE + 1;
//    }
//
//
//}
